A quaternion is a way to represent three dimensional spatial rotation.\\
  \begin{wrapfigure}[12]{r}{4cm}
         \includegraphics[scale=0.8]{img/200px-Plane.png}
         \caption{3D representation of Euler angles}
    \end{wrapfigure}   
A quaternion can be described as :
\begin{displaymath}
    q = \left(
        \begin{matrix}
            q_0\\
            q_1\\
            q_2\\
            q_3\\
        \end{matrix}
    \right)
    with\ |q^2| = q_0^2 + q_1^2 + q_2^2 + q_3^2 = 1
\end{displaymath}
  
  
It is possible to convert a quaternion to three Euler angle using the following formula :
\begin{displaymath}
    \left(
    \begin{matrix}
        \phi\\
        \theta\\
        \psi
    \end{matrix}
    \right)
    =
    \left(
    \begin{matrix}
        atan2(2(q_0q_1+q_2q_3), 1 - 2(q_1^2 + q_2^2))\\
        arcsin(2(q_0q_2 - q_3q_1))\\
        atan2(2(q_0q_3+q_1q_2), 1 - 2(q_2^2 + q_3^2))\\
    \end{matrix}
    \right)
\end{displaymath}
    with : 
    \begin{itemize}
        \item[$\phi$]   the rotation about X-axis
        \item[$\theta$] the rotation about Y-axis
        \item[$\psi$]  the rotation about Z-axis
    \end{itemize}


